//
//  AboutUs.m
//  FreeReading
//
//  Created by lanou3g on 15/11/3.
//  Copyright © 2015年 lanou3g. All rights reserved.
//

#import "AboutUs.h"

@interface AboutUs ()

@end

@implementation AboutUs

- (void)viewDidLoad {
    [super viewDidLoad];
    [self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"navBar"] forBarMetrics:(UIBarMetricsDefault)];
    self.view.backgroundColor = [UIColor whiteColor];
    UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 100, 30)];
    titleLabel.textAlignment = NSTextAlignmentCenter;
    titleLabel.textColor = [UIColor whiteColor];
    titleLabel.text = @"关于我们";
    self.navigationItem.titleView = titleLabel;
    self.navigationController.navigationBar.tintColor = [UIColor whiteColor];
    [self addSubViews];
}

-(void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    [self.navigationController setNavigationBarHidden:NO animated:YES];
}

- (void)addSubViews
{
    
    UIBarButtonItem *leftBar = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"iconfont-arrowleft"] style:(UIBarButtonItemStylePlain) target:self action:@selector(leftButton:)];
    self.navigationItem.leftBarButtonItem = leftBar;
    
    UIImageView *imageView = [[UIImageView alloc] initWithFrame:self.view.bounds];
    
    imageView.image = [UIImage imageNamed:@"mine.jpg"];
    [self.view addSubview:imageView];
    
    
    UILabel *contentLabel = [[UILabel alloc] initWithFrame:CGRectMake(kMargin * 2, 100, kScreenWidth - kMargin * 4, 100)];
    contentLabel.font = [UIFont systemFontOfSize:16];
    contentLabel.numberOfLines = 0;
    contentLabel.text = @" 制作团队:  刘新林 李雨 张明军\n\n欢迎提出你在使用的过程中遇到的问题或宝贵意见,感谢您对我们的支持\n\n\n联系我们:关注博客:@Loving_ios\n\n反馈:Email:15039284023@163.com";
   CGFloat height = [self getLabelHeightWithContent:contentLabel.text];
    CGRect newFrame = contentLabel.frame;
    newFrame.size.height = height;
    contentLabel.frame = newFrame;
    [imageView addSubview:contentLabel];
    
}
- (CGFloat)getLabelHeightWithContent:(NSString *)content
{
    CGRect frame = [content boundingRectWithSize:CGSizeMake(kScreenWidth - kMargin * 4, 100000) options:(NSStringDrawingUsesLineFragmentOrigin) attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:16]} context:nil];
    
    return frame.size.height;
}


- (void)leftButton:(UIBarButtonItem *)leftButton
{
    
    
    [self.navigationController popToRootViewControllerAnimated:YES];
    
}




#pragma mark - 内存警告
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
    if ([self isViewLoaded] && self.view.window == nil) {
        
        self.view = nil;
    }
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
